

import 'package:bt_tool/basic/bt_language_tool.dart';
import 'package:bt_tool/widget/bt_base_btn_widget.dart';
import 'package:bt_tool/widget/bt_form_select_widget.dart';
import 'package:bt_tool/widget/bt_text_field.dart';
import 'package:bt_tool/widget/bt_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo/tools/translate/controller/translate_main_controller.dart';
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart';

import '../../../common/config/app_theme_color_config.dart';

class TranslateMainHeadToolWidget extends BTStatelessWidget{

  final TranslateMainController controller;

  const TranslateMainHeadToolWidget({
    super.key,
    super.routerConfig,
    required this.controller
  });

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        const SizedBox(width: 10,),
        SizedBox(
          width: 180,
          height: 30,
          child: Obx(()=>BTFormSelectWidget(
            titleStr: "当前数据：".btTrans,
            dataList: controller.dataStatusList.value,
            callback: (model){
              for(var m in controller.dataStatusList.value){
                m.isSelect = false;
              }
              model.isSelect = true;
              controller.dataStatusList.refresh();
              controller.dataStatus = model.id;
              controller.refreshData();
            },
          )),
        ),
        const SizedBox(width: 10,),
        SizedBox(
          width: 180,
          height: 30,
          child: BTTextFieldWidget(
            btTextFieldController: controller.textFieldController,
            hintText: "搜索KEY".btTrans,
            textFieldPadding: const EdgeInsets.only(left: 5,bottom: 18,right: 5),
            textStyle: const TextStyle(fontSize: 14),
            suffixIconConstraints: const BoxConstraints.expand(width: 18,height: 18),
          ),
        ),
        const SizedBox(width: 10,),
        Expanded(
          child: Container(),
        ),
        SizedBox(height: 31,child: BTBtnTextWidget(
          // constraints: const BoxConstraints.expand(height: 35,width: 100),
          bgColor: AppThemeColor.mainColor,
          text: "查询数据".btTrans,
          textColor: Colors.white,
          onTap: () => controller.refreshData(),
          alignment: Alignment.center,
        ),),
        const SizedBox(width: 10,),
      ],
    );
  }

}